$(function(){
	$('#tt').datagrid({
		url: '../statics/json/demo.json',
		title: '用户信息列表',
		width: 800,
		height: 500,
		fitColumns: true,
		nowrap:false,
		columns:[[
			{field:'car_type',title:'用户名',width:120,align:'center'},
			{field:'inprice',title:'用户角色',width:150,align:'center'},
			{field:'outprice',title:'联系方式',width:150,align:'center'},
			{field:'color',title:'入职时间',width:150,align:'center'},
			{field:'qudong',title:'角色分配',width:100,align:'center'},
			{field:'made',title:'密码重置',width:100,align:'center'},
			{field:'opr1',title:'删除用户',width:100,align:'center',formatter:function(){
				return "<a herf='#' style='color:red;'>删除</a>";
			}}
		]],
		onClickCell:function(index,field,v){
			if(field=="opr1"){
				var id = $(this).datagrid("getRows")[index].id;
				window.location.href="/managerUser/DelUser.do?user.id="+id;
			}
		},
		pagination:true,
		rownumbers:true,
		toolbar:[{
			id:"code",
			text:'添加用户',
			iconCls:'icon-add', 
			handler:function(){
				$('#btnsave').linkbutton('enable');
				//console.log(v[0].code);   供后者传递值进行针对性修改数据
					$('#dd').dialog({    
					    title: '添加用户',    
					    width: 600,    
					    height: 560,    
					    closed: false,    
					    cache: false,    
					    href: '../CarManager/addcar1.jsp',     //  对url传值 并且传递给相应的界面
					    modal: true,
					    buttons:[{
							text:'提交',
							iconCls:'icon-ok',
							handler:function(){
								$('#ff').form('submit');
							}
						},{
							text:'清空',
							iconCls:'icon-no',
							handler:function(){
								$('#ff').form('clear');
							}
						},{
							text:'取消',
							handler:function(){
								$('#dd').dialog('close');
							}
						}]
					});    
			}
		
		}],
		loadMsg:"正在努力加载！",
		pageList:[5,10,15,20],
		pageSize:15,
		rowStyler:function(index,row,css){
			if (row.listprice>80){
				return 'background-color:#6293BB;color:#fff;font-weight:bold;';
			}
		}
	});
});